package io.renren.modules.cuthisdata.service.impl;

import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.cuthisdata.dao.CuthisDao;
import io.renren.modules.cuthisdata.entity.CuthisEntity;
import io.renren.modules.cuthisdata.service.CuthisService;


@Service("cuthisService")
public class CuthisServiceImpl extends ServiceImpl<CuthisDao, CuthisEntity> implements CuthisService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<CuthisEntity> page = this.page(
                new Query<CuthisEntity>().getPage(params),
                //根据timestamp字段排序
                new QueryWrapper<CuthisEntity>().like("devicename",params.get("key")).orderBy(true,false,"timestamp")
        );

        return new PageUtils(page);
    }

}